package com.jsmile.cloud.taskcenter.api.feign;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jsmile.cloud.taskcenter.api.constants.TaskConstants;
import com.jsmile.cloud.taskcenter.api.req.*;
import com.jsmile.mall.api.JSmileResult;

@FeignClient(value = TaskConstants.APPLICATION_NAME, contextId = "task")
public interface TaskServiceApi {

    @RequestMapping(value = "/feign/task/addTask", method = RequestMethod.POST)
    JSmileResult addTask(@RequestBody @Valid ReqTaskInsert reqTaskInsert);

    @RequestMapping(value = "/feign/task/pauseJob", method = RequestMethod.POST)
    JSmileResult pauseJob(@RequestBody @Valid ReqBatchTaskDetail reqBatchTaskDetail);

    @RequestMapping(value = "/feign/task/resumeJob", method = RequestMethod.POST)
    JSmileResult resumeJob(@RequestBody @Valid ReqBatchTaskDetail reqBatchTaskDetail);

    @RequestMapping(value = "/feign/task/runJob", method = RequestMethod.POST)
    JSmileResult runJob(@RequestBody @Valid ReqBatchTaskDetail reqBatchTaskDetail);

    @RequestMapping(value = "/feign/task/deleteTasks", method = RequestMethod.POST)
    JSmileResult deleteTasks(@RequestBody @Valid ReqTaskDelete reqTaskDelete);

    @RequestMapping(value = "/feign/task/detail", method = RequestMethod.POST)
    JSmileResult detail(@RequestBody @Valid ReqTaskDetail reqTaskDetail);

    @RequestMapping(value = "/feign/task/page", method = RequestMethod.POST)
    JSmileResult page(@RequestBody @Valid ReqTaskQuery reqTaskQuery);
}
